package d.n.d.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import d.n.d.dao.CustomerDao;
import d.n.d.domain.Customer;

/**
 * 
 * @author D.N.D
 *
 */
@Service
public class CustomerServiceImpl implements CustomerService {

	@Autowired
	private CustomerDao customerDao;

	/**
	 * <br> Author: DucDS </br>
	 * @return Customer
	 */
	public Customer searchCustomerByIDCard(String IDcard) {
		
		List<Customer> customers = customerDao.getAllCustomer();
		Customer cust = null;
		for (Customer customer : customers) {
			if (customer.getIdCardNumber().equals(IDcard)) {
				cust = customer;
				break;
			}
		}
		return cust;
	}
}
